<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ include file="../common/taglibs.jsp"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="${rootPath}/css/a.css" type="text/css" rel="stylesheet" />
<link href="${rootPath}/css/index.css" type="text/css" rel="stylesheet" />
<link href="${rootPath}/css/common.css" type="text/css" rel="stylesheet" />
<title>终端统计</title>

<script type="text/javascript"
	src="<s:url value="/js/jquery-1.3.2.js" />"></script>
<script type="text/javascript" src="<s:url value="/js/common.js" />"></script>
<script language="javascript" type="text/javascript"
	src="<s:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>
<script type='text/javascript' src='<s:url value="/dwr/engine.js"/>'></script>
<script type='text/javascript' src='<s:url value="/dwr/interface/MccQuery.js"/>'></script>

<!-- 当前页面样式 -->
<script type="text/javascript" src="<s:url value="/js/jquery-1.9.1.js" />"></script>
	
<!-- jQuery UI 插件 -->
<script src=<s:url value="/js/ui/jquery.ui.core.js"/>></script>
<script src=<s:url value="/js/ui/jquery.ui.widget.js"/>></script>
<script src=<s:url value="/js/ui/jquery.ui.position.js"/>></script>
<script src=<s:url value="/js/ui/jquery.ui.menu.js"/>></script>
<script src=<s:url value="/js/ui/jquery.ui.autocomplete.js"/>></script>
<script type='text/javascript' src='<s:url value="/js/querySon.js"/>'></script>

<link rel="stylesheet" href=<s:url value="/css/demos.css"/>>
	
<style>
		 .fieldError { color: red; text-align: left; }
		.error { float: none; color: red;  vertical-align: top;font-size: 11px;}
		.ui-autocomplete {
		max-height: 200px;
		overflow-y:auto;
		overflow-x: hidden;
	}
	/* IE 6 doesn't support max-height
	 * we use height instead, but this forces the menu to always be this tall
	 */
	* html .ui-autocomplete {
		height: 100px;
	}
</style>


<script type="text/javascript">
$(document).ready(function(){
	var tjtype = ${statisticsType};
	var selectype = document.getElementById('statisticsType');
		if(tjtype == '1'){
			selectype[0].selected = true;
			$("#activDate").hide();
		}else if(tjtype == '2'){
			selectype[1].selected = true;
			$("#activDate").show();
		}else if(tjtype == '3'){
			selectype[2].selected = true;
			$("#activDate").show();
		}
		
		$("#statisticsType").change(function(){
			$("#startTrnDate").val("");
			$("#endTrnDate").val("");
			var stype = $("#statisticsType").val();
			if(stype == '1'){
				$("#activDate").hide();	//隐藏
			}else{
				$("#activDate").show();	//显示
			}
		});	
	
		$("#sub").click(function(){
			$("#sub").attr({"disabled":"disabled"});
			var statisticsType = $("#statisticsType").val();
			if(statisticsType == 1){
				$("#importForm").attr("action","<%=basePath%>/termSnBatchStatistics/queryTermSnBatchStatisticsList.ct");
				$("#importForm").submit();
			}else{
				$("#importForm").attr("action","<%=basePath%>/termActivateStatistics/queryTermActivateStatisticsList.ct?effectAct="+statisticsType);
				$("#importForm").submit();
			}
		});
		
		$("#szPower").click(function() {
			var statisticsType = $("#statisticsType").val();
			if(statisticsType == 1){
				$("#importForm").attr("action","<%=basePath%>/termSnBatchStatistics/excelTermSnBatchStatisticsList.ct");
				$("#importForm").submit();
			}else{
				$("#importForm").attr("action","<%=basePath%>/termActivateStatistics/excelTermActivateStatisticsList.ct?effectAct="+statisticsType);
				$("#importForm").submit();
			}
		});				
	}); 
	
</script>
</head>
<body>
<table class="tb">
    <tbody>
		<s:form id="importForm" action="queryTermSnBatchStatisticsList.ct" method="post"
			namespace="/termSnBatchStatistics"  theme="simple">
			<input id="today" value="${today }" type="hidden"/>
	<%-- 	<s:hidden name="currentAgentFlag" value="%{currentAgentFlag}"/> --%>
			<tr class="tb-line">
				<td class="tb-td" colspan="6"><div class="tb-h2">POS收单运营管理平台</div></td>
			</tr>
			<tr class="tb-line">
				<td class="tb-td" colspan="6"><div class="tb-h3">终端统计</div></td>
			</tr>
			<tr class="tb-line">
				<td width="12%" style="min-width: 150px" align="right" class="tb-td">
					<div class="tb-h4">统计类型：</div>
				</td>
				<td class="tb-td">
					<select id="statisticsType" >
							<option value='1'>绑定统计</option>
							<option value='2'>激活统计</option>
							<option value='3'>有效商户激活统计</option>
					</select>
				</td>
				<td width="12%" style="min-width: 150px" align="right" class="tb-td">
					<div class="tb-h4">一级代理商名称：</div>
				</td>
				<td class="tb-td">
				<span><!-- 
					<input id="showOneAgentId" name="searchCondition.agentId"  type="hidden"/> -->
					<input id="showOneAgentName" name="searchCondition.agentName"  placeholder="输入代理商名称" style="width:300px;"
						value="<s:property value="searchCondition.agentName"/>" />
				</span>	
					</td>
			</tr>
			<tr class="tb-line">
				<td width="12%" style="min-width: 150px" align="right" class="tb-td">
					<div class="tb-h4">终端序列号：</div>
				</td>
				<td class="tb-td" >
					<label class="tb-input-normal"> 
						<s:textfield id="serialNum" name="searchCondition.serialNum" cssClass="queryWidth" />
					</label>
				</td>
				<td align="right" class="tb-td">
					<div class="tb-h4">品牌：</div>
				</td>
				<td class="tb-td">
					<label class="tb-select">
						<s:select cssClass="queryWidth" name="searchCondition.posBrand" id="posBrand" 
								list="#request.brandMap" listKey="key" listValue="value"  headerKey="-1" headerValue="不限"/>
					</label>
				</td>
			</tr>
			<tr class="tb-line">
				<td width="12%" style="min-width: 150px" align="right" class="tb-td">
					<div class="tb-h4">绑定起始日期：</div>
				</td>
				<td class="tb-td" colspan='3'>
					<label class="tb-input-mini">
						<s:textfield id="startBrandDate" name="searchCondition.startBrandDate" onFocus="WdatePicker({dateFmt:'yyyyMMdd',readOnly:true,wdate:true,errDealMode:0});"
							theme="simple" cssClass="queryWidth" /> 
					</label>至：
					<label class="tb-input-mini">
						<s:textfield id="endBrandDate" name="searchCondition.endBrandDate" onFocus="WdatePicker({dateFmt:'yyyyMMdd',readOnly:true,wdate:true,errDealMode:0});"
							theme="simple" cssClass="queryWidth" />
					</label>
				</td>
			</tr>
			<tr id="activDate" class="tb-line" >
				<td width="12%" style="min-width: 150px" align="right" class="tb-td">
					<div class="tb-h4">激活起始日期：</div>
				</td>
				<td class="tb-td" colspan='3'>
					<label class="tb-input-mini">
					<s:textfield id="startTrnDate" name="searchCondition.startTrnDate" onFocus="WdatePicker({dateFmt:'yyyyMMdd',readOnly:true,wdate:true,errDealMode:0});"
							theme="simple" cssClass="queryWidth" /> 
					</label>至：
					<label class="tb-input-mini">
						<s:textfield id="endTrnDate" name="searchCondition.endTrnDate" onFocus="WdatePicker({dateFmt:'yyyyMMdd',maxDate:'%y-%M-#{%d-1}',readOnly:true,wdate:true,errDealMode:0});"
							theme="simple" cssClass="queryWidth" />
					</label>
				</td>
			</tr>
			<tr>
				<td colspan="6">&nbsp;</td>
			</tr>
			<tr>
				<td colspan="6" align="center"><div style="color: blue;">
						<s:actionmessage />
					</div>
					<div style="color: red;">
						<s:actionerror />
					</div>
				</td>
			</tr>
			<tr class="tb-line">
				<td class="tb-td line-submit" align="right" colspan="6">
					<label class="tb-input-submit">
				 		<s:submit value="查询" id="sub" /> 
					</label>
					<label class="tb-input-submit">
						<s:reset value="取  消" />
					</label>
					<s:if test="#request.searchRsList != null && #request.searchRsList.size>0">
						<label class="tb-input-submit">
							<input id="szPower" type="submit" value="导出Excel" />
						</label>
					</s:if>
					<s:else>
						<label class="tb-input-submit">
							<input id="szPower" disabled="disabled" value="导出Excel" type="submit" />
						</label>
					</s:else>
				</td>
			</tr>
			<table width="100%" cellpadding="0" cellspacing="0" border="0">
				<s:if test="#request.statisticsType == \"1\"">
				<s:if
					test="#request.searchRsList != null && #request.searchRsList.size>0">
					<tr class="tb-line">
							<td class="tb-td paging" colspan="12" align="left">&nbsp;&nbsp;&nbsp;&nbsp; <page:pageCount
								max_pages="11" totalPage="${requestScope.totalPage}"
								currentPage="${requestScope.currentPage}"
								action="${rootPath}/termSnBatchStatistics/queryTermSnBatchStatisticsList.ct?currentPage=" />
							</td>
					</tr>
				</s:if>
			</s:if>
			<s:else>
				<s:if
					test="#request.searchRsList != null && #request.searchRsList.size>0">
					<tr class="tb-line">
						<td class="tb-td paging" colspan="12" align="left">&nbsp;&nbsp;&nbsp;&nbsp; <page:pageCount
								max_pages="11" totalPage="${requestScope.totalPage}"
								currentPage="${requestScope.currentPage}"
								action="${rootPath}/termActivateStatistics/queryTermActivateStatisticsList.ct?effectAct=${effectAct}&currentPage=" />
						</td>
					</tr>
				</s:if>
			</s:else>	
			</table> 
		</s:form>
	</tbody>
</table>
<div class="big-tb">
	<table class="tb" style="width: 100%;">
		<s:if test="#request.statisticsType == \"1\"">
			<thead>
					<tr class="tb-line">
						<th class="tb-th" colspan="13">终端绑定统计信息列表</th>
					</tr>
					<tr class="tb-line bg-gray">
						<th class="tb-th">所属分公司</th>
						<th class="tb-th">所属一级代理商</th>
						<th class="tb-th">代理商</th>
						<th class="tb-th">SN号</th>
						<th class="tb-th">品牌</th>
						<th class="tb-th">绑定日期</th>
						<th class="tb-th">终端号</th>
						<th class="tb-th">商户号</th>
		<!-- 			<th class="tb-th">创建时间</th>
						<th class="tb-th">更新时间</th> -->
					</tr>
				</thead>
				<tbody>
					<s:iterator value="terminalList" status="stat" id="term">
						<tr class="tb-line">
							<td class="tb-td" align="center">
							 <s:property value="#term.companyName"/>
							</td>
							<td class="tb-td" align="center">
							 <s:property value="#term.oneagentName"/>
							</td>
							<td class="tb-td" align="center">
							 <s:property value="#term.agentName"/>
							</td>
							<td class="tb-td" align="center">
							 <s:property value="#term.serialNum"/>
							</td>
							<td class="tb-td" align="center">
							 <s:property value="#term.posBrand"/>
							</td>
							<td class="tb-td" align="center">
							 <s:property value="#term.brandDateStr"/>
							</td>
							<td class="tb-td" align="center">
							 <s:property value="#term.termId"/>
							</td>
							<td class="tb-td" align="center">
							 <s:property value="#term.mchntCd"/>
							</td><%-- 
							<td class="tb-td" align="center">
							 <s:property value="#term.dtCreateStr"/>
							</td>
							<td class="tb-td" align="center">
							 <s:property value="#term.dtLastmodStr"/>
							</td> --%>
						</tr>
						</s:iterator>
				</tbody>
			</s:if>	
			<s:else>
				<thead>
					<tr class="tb-line">
						<s:if test="#request.statisticsType == \"2\"">
							<th class="tb-th" colspan="13">终端激活统计信息列表</th>
						</s:if>
						<s:else>
							<th class="tb-th" colspan="13">终端有效商户激活统计信息列表</th>
						</s:else>
					</tr>
					<tr class="tb-line bg-gray">
						<th class="tb-th">区域</th>
						<th class="tb-th">一级代理商</th>
						<th class="tb-th">代理商</th>
						<th class="tb-th">SN</th>
						<th class="tb-th">厂商</th>
						<th class="tb-th">商户号</th>
						<th class="tb-th">终端</th>
						<th class="tb-th">绑定日期</th>
						<th class="tb-th">激活日期</th>
			<!-- 		<th class="tb-th"></th> -->
						<th class="tb-th">创建时间</th>
						<th class="tb-th">更新时间</th>
					</tr>
				</thead>
				<tbody>
					<s:iterator value="terminalList" status="stat" id="term">
						<tr class="tb-line">
							<td class="tb-td" align="center">
							 <s:property value="#term.companyName"/>
							</td>
							<td class="tb-td" align="center">
							 <s:property value="#term.oneagentName"/>
							</td>
							<td class="tb-td" align="center">
							 <s:property value="#term.agentName"/>
							</td>
							<td class="tb-td" align="center">
							 <s:property value="#term.serialNum"/>
							</td>
							<td class="tb-td" align="center">
							 <s:property value="#term.posBrand"/>
							</td>
							<td class="tb-td" align="center">
							 <s:property value="#term.mchntCd"/>
							</td>
							<td class="tb-td" align="center">
							 <s:property value="#term.termId"/>
							</td>
							<td class="tb-td" align="center">
							 <s:property value="#term.brandDate"/>
							</td>
							<td class="tb-td" align="center">
							 <s:property value="#term.trnDate"/>
							 </td><%-- 
							<td class="tb-td" align="center">
							 <s:property value="#term.trnAt"/>
							 </td> --%>
							<td class="tb-td" align="center">
							 <s:property value="#term.dtCreate"/>
							</td>
							<td class="tb-td" align="center">
							 <s:property value="#term.dtLastmod"/>
							</td>
						</tr>
						</s:iterator>
				</tbody>
			</s:else>
	</table>
</div>

</body>
</html>